/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import model.Base;
import view.ChangePasswordWindow;

/**
 *
 * @author Ira
 */
public class ChangePasswordController implements ActionListener {

	private Base model;
	private ChangePasswordWindow view;
	
	
	public ChangePasswordController(Base model, ChangePasswordWindow view) {
		this.model = model;
		this.view = view;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		String s = ((JButton)e.getSource()).getName();
		
		if(s.equals(ChangePasswordWindow.BTN_CANCEL)) {
			this.view.dispose();
		}
		else if(s.equals(ChangePasswordWindow.BTN_OK)) {
			this.model.changePass(this.view.getPass());
			this.view.dispose();
		}
		
	}
	
}
